package com.gw.booking.util;

import org.apache.log4j.Logger;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigProperties {

	static Properties p = null;

	// 读取配置文件；
	static {
		InputStream inputStream = null;
		p = null;
		try {
			inputStream = ConfigProperties.class.newInstance().getClass().getClassLoader()
					.getResourceAsStream("resources/Config.properties");
			p = new Properties();
			try {
				p.load(inputStream);
			} catch (IOException e1) {
				Logger logger = Logger.getLogger(ConfigProperties.class.getName());
				logger.info("读取配置文件异常 ");
			}
		} catch (Exception e) {
			Logger logger = Logger.getLogger(ConfigProperties.class.getName());
			logger.info("读取配置文件异常 ");
		} finally {
			if (inputStream != null) {
				try {
					inputStream.close();
				} catch (Exception e) {

				}
			}
		}
	}

	/**
	 * 得到后台服务器图片地址；
	 * 
	 * @return
	 */
	public static String getImagePath() {
		return p.getProperty("imgPath");
	}

	/**
	 * 得到商家版安卓推送appKey
	 * 
	 * @return
	 */
	public static String getBusinessAndroidAppKey() {
		return p.getProperty("business.android.appKey");
	}

	/**
	 * 得到商家版安卓推送masterSecret
	 * 
	 * @return
	 */
	public static String getBusinessAndroidMasterSecret() {
		return p.getProperty("business.android.masterSecret");
	}

	/**
	 * 得到商家版IOS推送appKey
	 * 
	 * @return
	 */
	public static String getBusinessIOSAppKey() {
		return p.getProperty("business.ios.appKey");
	}

	/**
	 * 得到商家版IOS推送masterSecret
	 * 
	 * @return
	 */
	public static String getBusinessIOSMasterSecret() {
		return p.getProperty("business.ios.masterSecret");
	}

	/**
	 * 得到酒店版安卓推送appKey
	 * 
	 * @return
	 */
	public static String getRestaurantAndroidAppKey() {
		return p.getProperty("restaurant.android.appKey");
	}

	/**
	 * 得到酒店版安卓推送masterSecret
	 * 
	 * @return
	 */
	public static String getRestaurantAndroidMasterSecret() {
		return p.getProperty("restaurant.android.masterSecret");
	}

	/**
	 * 得到酒店版IOS推送appKey
	 * 
	 * @return
	 */
	public static String getRestaurantIOSAppKey() {
		return p.getProperty("restaurant.ios.appKey");
	}

	/**
	 * 得到酒店版IOS推送masterSecret
	 * 
	 * @return
	 */
	public static String getRestaurantIOSMasterSecret() {
		return p.getProperty("restaurant.ios.masterSecret");
	}
}
